﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Text;
using RipPoll.Business;
using RipPoll.Library;
using RipPoll.Services.Contracts;

namespace RipPoll.Services.Library
{
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class CommunityServices : ICommunityServices
    {

        public string[] GetZipCodesForCommunityId(int communityId)
        {

            CommunityBO cbo = new CommunityBO();
            return cbo.GetPollZipCodes(communityId);
        }


        public void AddCommunity(CommunityPE commPE, UserPE upe)
        {
            CommunityBO cbo = new CommunityBO();
            cbo.AddCommunity(commPE, upe);
            cbo = null;
        }

        public List<RipPoll.Library.CommunityPE> GetUnApprovedCommunities()
        {

            CommunityBO cbo = new CommunityBO();
            return cbo.GetUnApprovedCommunities();
        }

        public void ApproveCommunity(int id)
        {
            CommunityBO cbo = new CommunityBO();
            cbo.ApproveCommunity(id);
            cbo = null;
        }

        public List<CommunityPE> GetUserCommunities(int userId)
        {
            CommunityBO cbo = new CommunityBO();
            return cbo.GetUserCommunities(userId);            
        }

        
    }
}
